home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iacrecord.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.9 KB  |  107 lines  |  [TEXT/KAHL]

  1.  
  2. /*© Copyright 1988-1993 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4. #include "iacinternal.h"
  5.  
  6.  
  7.  
  8. Boolean IACpushrecordparam (AERecord * val, OSType keyword) {
  9.     
  10.     return (IACpushrecorditem (IACglobals.event, val, keyword));
  11.     } /*IACpushrecordparam*/
  12.  
  13.  
  14. Boolean IACreturnrecord (AERecord *val) {
  15.     
  16.     return (IACpushrecorditem (IACglobals.reply, val, keyDirectObject));
  17.     } /*IACreturnrecord*/
  18.  
  19.  
  20. Boolean IACgetrecordparam (OSType keyword, AERecord *val) {
  21.     
  22.     if (!IACgetrecorditem (IACglobals.event, keyword, val)) {
  23.         
  24.         IACparamerror (IACglobals.errorcode, "\precord", keyword);
  25.         
  26.         return (false);
  27.         }
  28.     
  29.     IACglobals.nextparamoptional = false; /*must be reset for each param*/
  30.     
  31.     return (true);
  32.     } /*IACgetrecordparam*/
  33.     
  34.  
  35. Boolean IACgetrecorditem (AEDescList *list, long n, AERecord *val) {
  36.     
  37.     register OSErr ec;
  38.  
  39.     DescType key;
  40.     
  41.     Size actualSize;
  42.     
  43.     if ((*list).descriptorType != typeAEList) {
  44.     
  45.         ec = AEGetKeyDesc (list, n, typeAERecord, val);
  46.         
  47.         if (ec != errAEDescNotFound)
  48.             goto done;
  49.         }
  50.  
  51.     ec = AEGetNthDesc (list, n, typeAERecord, &key, val);
  52.     
  53.     done:
  54.     
  55.     IACglobals.errorcode = ec;
  56.     
  57.     return (ec == noErr);
  58.     } /*IACgetrecorditem*/
  59.  
  60.  
  61. Boolean IACpushrecorditem (AEDescList *list, AERecord *x, long n) {
  62.     
  63.     register OSErr ec;
  64.     
  65.     if ((*list).descriptorType != typeAEList)
  66.         ec = AEPutKeyDesc (list, n, x);
  67.     else
  68.         ec = AEPutDesc (list, n, x);
  69.     
  70.     IACglobals.errorcode = ec;
  71.     
  72.     AEDisposeDesc (x);
  73.     
  74.     (*x).descriptorType = typeNull;
  75.     
  76.     (*x).dataHandle = NULL;
  77.     
  78.     return (ec == noErr);
  79.     } /*IACpushrecorditem*/
  80.  
  81.  
  82. Boolean IACnewrecord (AERecord *record) {
  83.     
  84.     register OSErr ec;
  85.     
  86.     ec = AECreateList (NULL, (Size) 0, true, record);
  87.     
  88.     IACglobals.errorcode = ec;
  89.     
  90.     return (ec == noErr);
  91.     } /*IACnewrecord*/
  92.  
  93.  
  94. Boolean IACgetiteminfo (AERecord *record, long n, AEKeyword *key, DescType *type, Size *bytes) {
  95.  
  96.     register OSErr ec;
  97.     
  98.     ec = AEGetNthPtr (record, n, typeWildCard, key, type, NULL, (Size) 0, bytes);
  99.     
  100.     IACglobals.errorcode = ec;
  101.     
  102.     return (ec == noErr);
  103.     } /*IACgetiteminfo*/
  104.  
  105.  
  106.  
  107.